<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#375EAB">

  <title>watch - Go Documentation Server</title>

<link type="text/css" rel="stylesheet" href="static/style.css">

<script>window.initFuncs = [];</script>
<script src="static/jquery.js" defer="defer"></script>



<script>var goVersion = "go1.15.3";</script>
<script src="static/godocs.js" defer="defer"></script>
</head>
<body>

<div id="lowframe" style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;">
...
</div><!-- #lowframe -->

<div id="topbar" class="wide"><div class="container">
<div class="top-heading" id="heading-wide"><a href="http://localhost:7070/pkg/">Go Documentation Server</a></div>
<div class="top-heading" id="heading-narrow"><a href="http://localhost:7070/pkg/">GoDoc</a></div>
<a href="#" id="menu-button"><span id="menu-button-arrow">▽</span></a>
<form method="GET" action="/search">
<div id="menu" style="min-width: 60px;">

<span class="search-box"><input type="search" id="search" name="q" placeholder="Search" aria-label="Search" required=""><button type="submit"><span><!-- magnifying glass: --><svg width="24" height="24" viewBox="0 0 24 24"><title>submit search</title><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path><path d="M0 0h24v24H0z" fill="none"></path></svg></span></button></span>
</div>
</form>

</div></div>



<div id="page" class="wide" style="outline: currentcolor none 0px;" tabindex="-1">
<div class="container">


  <h1>
    Package watch
    <span class="text-muted"></span>
  </h1>







<div id="nav"></div>


<!--
	Copyright 2009 The Go Authors. All rights reserved.
	Use of this source code is governed by a BSD-style
	license that can be found in the LICENSE file.
-->
<!--
	Note: Static (i.e., not template-generated) href and id
	attributes start with "pkg-" to make it impossible for
	them to conflict with generated attributes (some of which
	correspond to Go identifiers).
-->

	<script>
	document.ANALYSIS_DATA = null;
	document.CALLGRAPH = null;
	</script>

	
		
		<div id="short-nav">
			<dl>
			<dd><code>import "github.com/user/watch"</code></dd>
			</dl>
			<dl>
			<dd><a href="#pkg-overview" class="overviewLink">Overview</a></dd>
			<dd><a href="#pkg-index" class="indexLink">Index</a></dd>
			
			
				<dd><a href="#pkg-subdirectories">Subdirectories</a></dd>
			
			</dl>
		</div>
		<!-- The package's Name is printed as title by the top-level template -->
		<div id="pkg-overview" class="toggleVisible">
			<div class="collapsed">
				<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2>
			</div>
			<div class="expanded">
				<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2>
				
				
			</div>
		</div>

		<div id="pkg-index" class="toggleVisible">
		<div class="collapsed">
			<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2>
		</div>
		<div class="expanded">
			<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2>

		<!-- Table of contents for API; must be named manual-nav to turn off auto nav. -->
			<div id="manual-nav">
			<dl>
			
			
				<dd><a href="#pkg-variables">Variables</a></dd>
			
			
				
				<dd><a href="#ListenFunc">func ListenFunc(filename string, listener Listener, Conf Configuration)</a></dd>
			
				
				<dd><a href="#PrintConf">func PrintConf(conf Configuration)</a></dd>
			
			
				
				<dd><a href="#Configuration">type Configuration</a></dd>
				
					
					<dd>&nbsp; &nbsp; <a href="#CreateConfiguration">func CreateConfiguration(filename string) Configuration</a></dd>
				
					
					<dd>&nbsp; &nbsp; <a href="#OpneFile">func OpneFile(filename string) (Configuration, error)</a></dd>
				
					
					<dd>&nbsp; &nbsp; <a href="#Watch">func Watch(filename string, listener Listener) (Configuration, error)</a></dd>
				
				
					
					<dd>&nbsp; &nbsp; <a href="#Configuration.ExistSection">func (Conf Configuration) ExistSection(section string) bool</a></dd>
				
					
					<dd>&nbsp; &nbsp; <a href="#Configuration.GetKey">func (Conf Configuration) GetKey(section string) *Section</a></dd>
				
					
					<dd>&nbsp; &nbsp; <a href="#Configuration.GetSection">func (Conf Configuration) GetSection() map[string]*Section</a></dd>
				
					
					<dd>&nbsp; &nbsp; <a href="#Configuration.GetSectionNum">func (Conf Configuration) GetSectionNum() int</a></dd>
				
			
				
				<dd><a href="#Listener">type Listener</a></dd>
				
				
			
				
				<dd><a href="#Section">type Section</a></dd>
				
				
					
					<dd>&nbsp; &nbsp; <a href="#Section.Equal">func (sec Section) Equal(obj Section) bool</a></dd>
				
					
					<dd>&nbsp; &nbsp; <a href="#Section.ExistKey">func (sec Section) ExistKey(key string) bool</a></dd>
				
					
					<dd>&nbsp; &nbsp; <a href="#Section.GetKey">func (sec Section) GetKey() map[string]string</a></dd>
				
					
					<dd>&nbsp; &nbsp; <a href="#Section.GetKeyNum">func (sec Section) GetKeyNum() int</a></dd>
				
					
					<dd>&nbsp; &nbsp; <a href="#Section.GetValue">func (sec Section) GetValue(key string) string</a></dd>
				
			
			
			</dl>
			</div><!-- #manual-nav -->

		

		
			<h3>Package files</h3>
			<p>
			<span style="font-size:90%">
			
				<a href="inner/section.go.html">section.go</a>
			
				<a href="inner/watch.go.html">watch.go</a>
			
			</span>
			</p>
		
		</div><!-- .expanded -->
		</div><!-- #pkg-index -->

		

		
		
			<h2 id="pkg-variables">Variables <a class="permalink" href="#pkg-variables">¶</a></h2>
			
				
				<pre>var (
    <span class="comment">//LineBreak 换行符号</span>
    <span id="LineBreak">LineBreak</span> <a href="http://localhost:7070/pkg/builtin/#byte">byte</a> = '\n'

    <span class="comment">//CommentSign ini配置文件中注释符号</span>
    <span class="comment">//Linus: #, Windows: ;</span>
    <span id="CommentSign">CommentSign</span> <a href="http://localhost:7070/pkg/builtin/#byte">byte</a> = '#'
)</pre>
			
		
		
			
			
			<h2 id="ListenFunc">func <a href="inner/watch.go.html?s=3598:3669#L154">ListenFunc</a>
				<a class="permalink" href="#ListenFunc">¶</a>
				
				
			</h2>
			<pre>func ListenFunc(filename <a href="http://localhost:7070/pkg/builtin/#string">string</a>, listener <a href="#Listener">Listener</a>, Conf <a href="#Configuration">Configuration</a>)</pre>
			<p>
ListenFunc 监听文件并调用相应方法
</p>

			
			

		
			
			
			<h2 id="PrintConf">func <a href="inner/watch.go.html?s=3332:3366#L143">PrintConf</a>
				<a class="permalink" href="#PrintConf">¶</a>
				
				
			</h2>
			<pre>func PrintConf(conf <a href="#Configuration">Configuration</a>)</pre>
			<p>
PrintConf 打印配置信息
</p>

			
			

		
		
			
			
			<h2 id="Configuration">type <a href="inner/watch.go.html?s=315:411#L12">Configuration</a>
				<a class="permalink" href="#Configuration">¶</a>
				
				
			</h2>
			<p>
Configuration 储存读取ini文件得到的信息
</p>

			<pre>type Configuration struct {
    <span class="comment">// contains filtered or unexported fields</span>
}
</pre>

			

			

			
			
			

			
				
				<h3 id="CreateConfiguration">func <a href="inner/watch.go.html?s=1664:1719#L67">CreateConfiguration</a>
					<a class="permalink" href="#CreateConfiguration">¶</a>
					
					
				</h3>
				<pre>func CreateConfiguration(filename <a href="http://localhost:7070/pkg/builtin/#string">string</a>) <a href="#Configuration">Configuration</a></pre>
				<p>
CreateConfiguration 创建Configuration类型数据并返回
</p>

				
				
			
				
				<h3 id="OpneFile">func <a href="inner/watch.go.html?s=1869:1922#L76">OpneFile</a>
					<a class="permalink" href="#OpneFile">¶</a>
					
					
				</h3>
				<pre>func OpneFile(filename <a href="http://localhost:7070/pkg/builtin/#string">string</a>) (<a href="#Configuration">Configuration</a>, <a href="http://localhost:7070/pkg/builtin/#error">error</a>)</pre>
				<p>
OpneFile 打开并读取ini文件
</p>

				
				
			
				
				<h3 id="Watch">func <a href="inner/watch.go.html?s=4529:4598#L195">Watch</a>
					<a class="permalink" href="#Watch">¶</a>
					
					
				</h3>
				<pre>func Watch(filename <a href="http://localhost:7070/pkg/builtin/#string">string</a>, listener <a href="#Listener">Listener</a>) (<a href="#Configuration">Configuration</a>, <a href="http://localhost:7070/pkg/builtin/#error">error</a>)</pre>
				<p>
Watch 读取文件并监听
</p>

				
				
			

			
				
				<h3 id="Configuration.ExistSection">func (Configuration) <a href="inner/watch.go.html?s=1487:1546#L61">ExistSection</a>
					<a class="permalink" href="#Configuration.ExistSection">¶</a>
					
					
				</h3>
				<pre>func (Conf <a href="#Configuration">Configuration</a>) ExistSection(section <a href="http://localhost:7070/pkg/builtin/#string">string</a>) <a href="http://localhost:7070/pkg/builtin/#bool">bool</a></pre>
				<p>
ExistSection 判断Section是否已经存在于Configuration.section中
</p>

				
				
				
			
				
				<h3 id="Configuration.GetKey">func (Configuration) <a href="inner/watch.go.html?s=1320:1377#L56">GetKey</a>
					<a class="permalink" href="#Configuration.GetKey">¶</a>
					
					
				</h3>
				<pre>func (Conf <a href="#Configuration">Configuration</a>) GetKey(section <a href="http://localhost:7070/pkg/builtin/#string">string</a>) *<a href="#Section">Section</a></pre>
				<p>
GetKey 返回字段为section的key
</p>

				
				
				
			
				
				<h3 id="Configuration.GetSection">func (Configuration) <a href="inner/watch.go.html?s=906:964#L43">GetSection</a>
					<a class="permalink" href="#Configuration.GetSection">¶</a>
					
					
				</h3>
				<pre>func (Conf <a href="#Configuration">Configuration</a>) GetSection() map[<a href="http://localhost:7070/pkg/builtin/#string">string</a>]*<a href="#Section">Section</a></pre>
				<p>
GetSection 返回Configuration类型中的section
</p>

				
				
				
			
				
				<h3 id="Configuration.GetSectionNum">func (Configuration) <a href="inner/watch.go.html?s=779:824#L38">GetSectionNum</a>
					<a class="permalink" href="#Configuration.GetSectionNum">¶</a>
					
					
				</h3>
				<pre>func (Conf <a href="#Configuration">Configuration</a>) GetSectionNum() <a href="http://localhost:7070/pkg/builtin/#int">int</a></pre>
				<p>
GetSectionNum 返回Configuration类型中的section字段数目
</p>

				
				
				
			
		
			
			
			<h2 id="Listener">type <a href="inner/watch.go.html?s=136:201#L4">Listener</a>
				<a class="permalink" href="#Listener">¶</a>
				
				
			</h2>
			<p>
Listener 当文件发生改变时调用的接口
</p>

			<pre>type Listener interface {
    Listen(<a href="#Configuration">Configuration</a>, <a href="#Configuration">Configuration</a>)
}</pre>

			

			

			
			
			

			

			
		
			
			
			<h2 id="Section">type <a href="inner/section.go.html?s=63:124#L1">Section</a>
				<a class="permalink" href="#Section">¶</a>
				
				
			</h2>
			<p>
Section 储存Section字段中的key-value组
</p>

			<pre>type Section struct {
    <span class="comment">// contains filtered or unexported fields</span>
}
</pre>

			

			

			
			
			

			

			
				
				<h3 id="Section.Equal">func (Section) <a href="inner/section.go.html?s=688:730#L26">Equal</a>
					<a class="permalink" href="#Section.Equal">¶</a>
					
					
				</h3>
				<pre>func (sec <a href="#Section">Section</a>) Equal(obj <a href="#Section">Section</a>) <a href="http://localhost:7070/pkg/builtin/#bool">bool</a></pre>
				<p>
Equal 判断两个section数值是否相同
</p>

				
				
				
			
				
				<h3 id="Section.ExistKey">func (Section) <a href="inner/section.go.html?s=552:596#L20">ExistKey</a>
					<a class="permalink" href="#Section.ExistKey">¶</a>
					
					
				</h3>
				<pre>func (sec <a href="#Section">Section</a>) ExistKey(key <a href="http://localhost:7070/pkg/builtin/#string">string</a>) <a href="http://localhost:7070/pkg/builtin/#bool">bool</a></pre>
				<p>
ExistKey 判断key是否存在
</p>

				
				
				
			
				
				<h3 id="Section.GetKey">func (Section) <a href="inner/section.go.html?s=267:312#L6">GetKey</a>
					<a class="permalink" href="#Section.GetKey">¶</a>
					
					
				</h3>
				<pre>func (sec <a href="#Section">Section</a>) GetKey() map[<a href="http://localhost:7070/pkg/builtin/#string">string</a>]<a href="http://localhost:7070/pkg/builtin/#string">string</a></pre>
				<p>
GetKey 得到key的复制
</p>

				
				
				
			
				
				<h3 id="Section.GetKeyNum">func (Section) <a href="inner/section.go.html?s=460:494#L15">GetKeyNum</a>
					<a class="permalink" href="#Section.GetKeyNum">¶</a>
					
					
				</h3>
				<pre>func (sec <a href="#Section">Section</a>) GetKeyNum() <a href="http://localhost:7070/pkg/builtin/#int">int</a></pre>
				<p>
GetKeyNum 得到Section中储存的key数目
</p>

				
				
				
			
				
				<h3 id="Section.GetValue">func (Section) <a href="inner/section.go.html?s=158:204#L1">GetValue</a>
					<a class="permalink" href="#Section.GetValue">¶</a>
					
					
				</h3>
				<pre>func (sec <a href="#Section">Section</a>) GetValue(key <a href="http://localhost:7070/pkg/builtin/#string">string</a>) <a href="http://localhost:7070/pkg/builtin/#string">string</a></pre>
				<p>
GetValue 根据key得到value
</p>

				
				
				
			
		
	

	





	
	
		<h2 id="pkg-subdirectories">Subdirectories <a class="permalink" href="#pkg-subdirectories">¶</a></h2>
	
	<div class="pkg-dir">
		<table>
			<tbody><tr>
				<th class="pkg-name">Name</th>
				<th class="pkg-synopsis">Synopsis</th>
			</tr>

			
			<tr>
				<td colspan="2"><a href="http://localhost:7070/pkg/github.com/user/">..</a></td>
			</tr>
			

			
				<tr>
				
					<td class="pkg-name" style="padding-left: 0px;">
						<a href="http://localhost:7070/pkg/github.com/user/watch/main/">main</a>
					</td>
				
					<td class="pkg-synopsis">
						
					</td>
				</tr>
			
		</tbody></table>
	</div>



<div id="footer">
Build version go1.15.3.<br>
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>,
the content of this page is licensed under the
Creative Commons Attribution 3.0 License,
and code is licensed under a <a href="http://localhost:7070/LICENSE">BSD license</a>.<br>
<a href="http://localhost:7070/doc/tos.html">Terms of Service</a> |
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a>
</div>

</div><!-- .container -->
</div><!-- #page -->


</body></html>